from matplotlib import pyplot as plt
import numpy as np

plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False

''' Fixed constants. '''
A = 1050000         # Initial principal.
rate = 0.049 / 12   # Monthly interest rate.
X_MIN = 10
X_MAX = 30
Y_MIN = 5000
Y_MAX = 20000


year = list(range(X_MIN, X_MAX + 1, 1))
cost = []
for n in year:
    pass
print('计算完成！')

''' Check point. '''
print(cost)

# plt.title('自设方式：年限-平均月供图')
# plt.axis([X_MIN, X_MAX, Y_MIN, Y_MAX])
# plt.xticks(list(range(X_MIN, X_MAX + 1, 1)))
# plt.yticks(list(range(Y_MIN, Y_MAX + 1, 1000)))
# plt.yticks(list(range(Y_MIN, Y_MAX + 1, 100000)),
#            list(range(int(Y_MIN / 10000), int(Y_MAX / 10000) + 1, 10)))
# plt.xlabel('年限（年）')
# plt.ylabel('平均月供（元）')
# plt.plot(year, cost, linestyle='-')
# plt.scatter(year[6:10], cost[6:10], s=16)
# plt.fill_between([10, 30], [8000] * 2, [7000] * 2, facecolor='lightgray')
# for i in range(6, 10):
#     plt.text(year[i], cost[i],
#              f'({year[i]}，{round(cost[i], 2)})', color='k')
# plt.vlines(year[6:10], [0] * 4, cost[6:10], linestyles='--')
# plt.grid()
# print('绘制完成！')
# plt.show()
